package com.sitanyun.merchant.guide.frament;


import android.os.Bundle;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;

import com.flyco.tablayout.SlidingTabLayout;
import com.sitanyun.merchant.guide.R;
import com.sitanyun.merchant.guide.adapter.TabAdapter;
import com.sitanyun.merchant.guide.base.BaseFragment;
import com.sitanyun.merchant.guide.frament.view.fragment.HistoryFragment;
import com.sitanyun.merchant.guide.frament.view.fragment.TodayUserFragment;

import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;
import butterknife.BindView;

/**
 * A simple {@link Fragment} subclass.
 */
public class UserFragment extends BaseFragment {

    @BindView(R.id.tv_return)
    ImageView tvReturn;
    @BindView(R.id.tv_title_str)
    TextView tvTitleStr;
    @BindView(R.id.image_right_key)
    ImageView imageRightKey;
    @BindView(R.id.tv_right_key)
    TextView tvRightKey;
    @BindView(R.id.ff_main_layout)
    FrameLayout ffMainLayout;
    @BindView(R.id.tab_view)
    SlidingTabLayout tabView;
    @BindView(R.id.vp_view)
    ViewPager vpView;
    private static final String[] mTitle = {"今日用户", "全部用户"};
    private static final BaseFragment[] size = new BaseFragment[]{new TodayUserFragment(), new HistoryFragment()};

    @Override
    public int getLayoutId() {
        return R.layout.fragment_user;
    }

    /**
     *
     * @param savedInstanceState
     */
    @Override
    public void initData(Bundle savedInstanceState) {
        vpView.setAdapter(new TabAdapter(getActivity(), getChildFragmentManager(), mTitle, size));
       tabView.setViewPager(vpView);

    }

    @Override
    public void initView() {
        tvTitleStr.setText("我的用户");
        tvReturn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                getActivity().finish();
            }
        });
    }
}
